home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / TUGU10.ZIP / JMOUSE.DOC < prev    next >
Text File  |  1995-04-06  |  5KB  |  112 lines

  1.  
  2.            JJ MM   MM  OOOO  UU  UU  SSSSS EEEEE
  3.            JJ MMM MMM OO  OO UU  UU SS     EE
  4.            JJ MM M MM OO  OO UU  UU  SSSS  EEEE
  5.        JJ  JJ MM M MM OO  OO UU  UU     SS EE
  6.         JJJJ  MM   MM  OOOO   UUUU  SSSSS  EEEEE
  7.  
  8.   Created by Jason Rennie for use in conjuction with TUGU.
  9.  
  10.   * Code copyright 1995 by Jason Rennie *
  11.  
  12.   This unit is a set of routines to lessen the burden on those who would
  13.   like to use the mouse in their applications created with TUGU.  It will
  14.   only work in VGA mode 13h.
  15.  
  16.   May only be distributed along with the TUGU package.  It may not be 
  17.   distributed separately.
  18.  
  19.   The following is a list of important variables used with JMOUSE:
  20.  
  21. mousecx, mousecy : integer;
  22.  
  23.   Change in mouse position since last check.  Changed every time MoveMouseA
  24.   is called.
  25.  
  26. mousex, mousey : integer;
  27.  
  28.   Current position of the mouse cursor on the screen.
  29.  
  30.   The following is a listing of the routines included in JMOUSE and a quick
  31.   description of what they are used for:
  32.  
  33. Procedure MouseStatus(Var chgx,chgy : integer; Var buttons : byte);
  34.  
  35.   This procedure will return the change in position of the mouse since this
  36.   procedure has last been called.  It will also return the button status
  37.   of the mouse (bit #0 = button #1, bit #1 = button #2, etc.).
  38.  
  39.         buttons pressed      chgx and chgy are in terms of pixels
  40.  
  41.     v        #1   #2
  42.     a    0 | -- | -- |
  43.     l    1 | XX | -- |
  44.     u    2 | -- | XX |
  45.     e    3 | XX | XX |
  46.  
  47. Procedure MoveMouseA(cursor : pointer; Var buttons : byte; backcolor : byte; Var lcursor : pointer);
  48. Procedure MoveMouseB(cursor : pointer; Var buttons : byte; backcolor : byte; Var lcursor : pointer);
  49.  
  50.   This is the heart of this unit.  These two procedures provide a simple
  51.   and automated way to control the mouse on the screen without having to
  52.   mess with the details.
  53.  
  54.   "cursor" is the pointer to the image of the mouse cursor.  It should be in
  55.   the standard TUGU image format, so it is best just to draw the cursor on
  56.   the screen and then use "getimage" to get the cursor.  There is also a
  57.   default cursor, called "cursorptr" which is automatically loaded with
  58.   jmouse.  This may be used by sending the variable "cursorptr" to "cursor".
  59.  
  60.   "buttons" is simply the returned button value.  See above for explaination.
  61.  
  62.   "backcolor" is the color you do not want displayed in the mouse cursor.  For
  63.   the default cursor, this is 0.  You should try values other than 0 so that
  64.   you can see what it does.  To display the mouse cursor on the screen, the
  65.   PutTransparent routine included with TUGU is used.
  66.  
  67.   "lcursor" is a pointer that holds the background image of the mouse.  Do
  68.   not worry too much about this variable, just make sure you use the same
  69.   pointer each time you call MoveMouse.  "lcursor" should not be assigned
  70.   before it is sent through MoveMouse.
  71.  
  72.   MoveMouseA will check to see if the mouse has been moved or any buttons
  73.   have been pressed since last check.  If so, the cursor will be cleared from
  74.   the screen.
  75.  
  76.   Between MoveMouseA and MoveMouseB, you are provided with the opportunity
  77.   to change the background according to what actions the user is performing.
  78.   You will only be given this opportunity to change the background ONLY if
  79.   an action is taken with the mouse (mouse is moved, button is pressed or
  80.   released - if the buttons value remains constant, the mouse cursor is NOT
  81.   cleared).  To check whether any mouse action has been taken, you should
  82.   compare the current "buttons" value to the last encountered and also check
  83.   the variables which describe any change in the mouse's position.  Those
  84.   variables are "mousecx" (change in x position) and "mousecy" (change in y
  85.   position).  A sample can be seen on line #484 of Fractal.pas.
  86.  
  87.   MoveMouseB will get the background for later clearing the cursor and then
  88.   replace the mouse cursor on to the screen (only if any action was taken).
  89.  
  90. Procedure ResetMouse(Var cursor : pointer; Var lcursor : pointer);
  91.  
  92.   This procedure is used any time a major screen change is performed or any
  93.   time you move from one mouse loop to another.  This will reset the mouse
  94.   so that it does not rely on any previous information.
  95.  
  96.   "cursor" is the image for the mouse cursor and "lcursor" is the pointer
  97.   used for the background image.  These must be passed to free up the memory
  98.   previously reserved for lcursor.
  99.  
  100. Procedure ChgMouseColor(cursor : pointer; c1 : byte);
  101.  
  102.   If you are using the standard cursor "cursorptr", you may not want the
  103.   cursor to be color #1 (however the background will always be #0), so to
  104.   change it, just send the cursor pointer to "cursor" and desired color to
  105.   "c1" and it will be changed.
  106.  
  107.  
  108. NOTE: If it seems that the mouse range is limited in any program, simply move
  109.       mouse all over the screen.  This is a consequence of the desire to give
  110.       the mouse unit the maximum detail allowable.  Without this, a minor
  111.       movement of the mouse may have shifted the on screen cursor a number of
  112.       pixels, rather than just one.